#include "attribute_config.h"

/*亮度调节*/
void RGB_brighness_handle(u8 num)
{
    if(num <= 0x3F)
    {
        set_brighness_level(num);
    }
}

/*主模式切换*/
void main_mode_handle(u8 num)
{
    app_logic_set_ssp(num);
}

/*场景子模式切换*/
void set_scene_handle(u8 num)
{
    set_scene_ssp(num);
}

/*场景模式子模式灵敏度*/
void set_scene_senet_handle(u8 num)
{
    set_scene_senet(num);
}

/*自定义模式子模式*/
void set_custom_ssp_handle(u8 num)
{
    set_custom_ssp(num);
}

/*自定义延时时间*/
void set_custom_light_wait_handle(u8 num) 
{
    set_light_wait(num);
}


/*自定义模式预览灯效*/
void set_light_effect_enum_hanle(u8 num)
{
    set_light_effect_enum(num);
}

/*设置麦克风灵敏度*/
void set_senst_level_hamdle(u8 num)
{
    set_senst_level(num);
}

/*麦克风子模式*/
void set_micro_ssp_hamdle(u8 num)
{
    set_micro_ssp(num);
}

/*高速模式指令帧处理*/
void set_high_speed_handle(u16 num,u8 *data)
{
    app_logic_set_ssp(SSP_HIGH_SPEED);
    set_cont_time(arch_os_ms_now());

    spi_send_param *spi_param = NULL;
    u8 *uart_rx_buffer = NULL;
    spi_param =(spi_send_param *)pvPortMalloc(sizeof(spi_send_param *));
    if (spi_param == NULL)
    {
        LOG_ERROR("pvPortMalloc create spi_param err\n");
        return;
    }

    uart_rx_buffer = (u8 *)pvPortMalloc(sizeof(u8 *)*(num));
    if(uart_rx_buffer == NULL)
    {
        LOG_ERROR("pvPortMalloc create uart_rx_buffer err\n");
        return;
    }
    
    memcpy(uart_rx_buffer,data,(num));

    spi_param->send_len = num; //待发送数据长度
    spi_param->send_data = uart_rx_buffer; //待发送的数据具体内容
    
    xQueueSend(spi_queue_handle,&spi_param,0);
    uart_rx_buffer =NULL; //防止野指针
    spi_param = NULL;
}








